﻿''' <summary>
''' Node class
''' </summary>
Public Class Node
	Inherits ArrayList
	Implements IRenderable
	Private bRender As Boolean = True

	Public Sub New()
		Dim mdl As New Model
		Me.AddItem(mdl)
	End Sub

	''' <summary>
	''' Add item to scene
	''' </summary>
	''' <param name="item">IRenderable element</param>
	Public Sub AddItem(ByVal item As IRenderable)
		Me.Add(item)
	End Sub

	''' <summary>
	''' Remove item from scene
	''' </summary>
	''' <param name="item">IRenderable element</param>
	Public Sub RemoveItem(ByVal item As IRenderable)
		Me.Remove(item)
	End Sub

	''' <summary>
	''' Remove item from scene
	''' </summary>
	''' <param name="item">integer index of element</param>
	Public Sub RemoveItem(ByVal item As Integer)
		Me.RemoveAt(item)
	End Sub
	''' <summary>
	''' Render all elements in array
	''' </summary>
	Public Sub Render() Implements IRenderable.Render
		If Me.bRender = False Then Exit Sub
		For i As Integer = 0 To Me.Count - 1
			CType(Item(i), IRenderable).Render()
		Next
	End Sub

	Public Function getRender() As Boolean Implements IRenderable.getRender
		Return Me.bRender
	End Function

	Public Sub setRender(ByVal value As Boolean) Implements IRenderable.setRender
		Me.bRender = value
	End Sub
End Class
